package cn.ibizlab.odoo.core.odoo_project.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Iproject_task;
import cn.ibizlab.odoo.core.odoo_project.domain.Project_task;
import cn.ibizlab.odoo.core.odoo_project.filter.Project_taskSearchContext;
import cn.ibizlab.odoo.core.odoo_project.service.IProject_taskService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[任务] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Project_taskServiceImpl implements IProject_taskService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Iproject_taskClientService project_taskClientService;

    @Override
    public boolean update(Project_task project_task) {
        boolean bOk = false ;
        Iproject_task clientModel = this.convert2Model(project_task,null);
        project_taskClientService.update(clientModel) ;
        this.convert2Domain(clientModel,project_task) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public Project_task get(Integer id) {
        Iproject_task clientModel = project_taskClientService.createModel();
        clientModel.setId(id);
        project_taskClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Project_task get(Project_task project_task) {
        Project_task retproject_task = this.get(project_task.getId()) ;
    	BeanCopier copier=BeanCopier.create(retproject_task.getClass(), project_task.getClass(), false);
        copier.copy(retproject_task, project_task, null);
        return project_task ;
    }

    @Override
    public void createBatch(List<Project_task> project_tasks, int batchSize) {

                        //project_taskClientService.createBatch(project_tasks,batchSize) ;

    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Iproject_task clientModel = project_taskClientService.createModel();
        clientModel.setId(id);
        project_taskClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public boolean create(Project_task project_task) {
        boolean bOk = false ;
        Iproject_task clientModel = this.convert2Model(project_task,null);
        project_taskClientService.create(clientModel) ;
        this.convert2Domain(clientModel,project_task);
        bOk = true ;

        return bOk ;
    }

    @Override
    public void updateBatch(List<Project_task> project_tasks, int batchSize) {

        //project_taskClientService.updateBatch(project_tasks,batchSize) ;

    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //project_taskClientService.removeBatch(project_tasks) ;

    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Project_task> searchDefault(Project_taskSearchContext context) {
        List<Project_task> list = new ArrayList<Project_task>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_task> clientModelList = project_taskClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_task clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_task>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据项目查询
     */
    @Override
    public Page<Project_task> selectByOdoo_project(Integer id){
        Project_taskSearchContext context = new Project_taskSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_task> list = new ArrayList<Project_task>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_task> clientModelList = project_taskClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_task clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_task>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据任务阶段查询
     */
    @Override
    public Page<Project_task> selectByOdoo_stage(Integer id){
        Project_taskSearchContext context = new Project_taskSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_task> list = new ArrayList<Project_task>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_task> clientModelList = project_taskClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_task clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_task>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据任务查询
     */
    @Override
    public Page<Project_task> selectByOdoo_parent(Integer id){
        Project_taskSearchContext context = new Project_taskSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_task> list = new ArrayList<Project_task>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_task> clientModelList = project_taskClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_task clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_task>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Project_task> selectByOdoo_company(Integer id){
        Project_taskSearchContext context = new Project_taskSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_task> list = new ArrayList<Project_task>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_task> clientModelList = project_taskClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_task clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_task>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Project_task> selectByOdoo_partner(Integer id){
        Project_taskSearchContext context = new Project_taskSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_task> list = new ArrayList<Project_task>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_task> clientModelList = project_taskClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_task clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_task>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Project_task> selectByOdoo_create(Integer id){
        Project_taskSearchContext context = new Project_taskSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_task> list = new ArrayList<Project_task>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_task> clientModelList = project_taskClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_task clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_task>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Project_task> selectByOdoo_user(Integer id){
        Project_taskSearchContext context = new Project_taskSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_task> list = new ArrayList<Project_task>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_task> clientModelList = project_taskClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_task clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_task>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Project_task> selectByOdoo_write(Integer id){
        Project_taskSearchContext context = new Project_taskSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_task> list = new ArrayList<Project_task>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_task> clientModelList = project_taskClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_task clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_task>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Iproject_task convert2Model(Project_task domain , Iproject_task model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = project_taskClientService.createModel() ;
        }

         if(domain.getDate_startDirtyFlag())
            model.setDate_start(domain.getDate_start());
         if(domain.getActivity_stateDirtyFlag())
            model.setActivity_state(domain.getActivity_state());
         if(domain.getRating_countDirtyFlag())
            model.setRating_count(domain.getRating_count());
         if(domain.getEmail_fromDirtyFlag())
            model.setEmail_from(domain.getEmail_from());
         if(domain.getAttachment_idsDirtyFlag())
            model.setAttachment_ids(domain.getAttachment_ids());
         if(domain.getDate_deadlineDirtyFlag())
            model.setDate_deadline(domain.getDate_deadline());
         if(domain.getKanban_state_labelDirtyFlag())
            model.setKanban_state_label(domain.getKanban_state_label());
         if(domain.getAccess_warningDirtyFlag())
            model.setAccess_warning(domain.getAccess_warning());
         if(domain.getRating_idsDirtyFlag())
            model.setRating_ids(domain.getRating_ids());
         if(domain.getRating_last_valueDirtyFlag())
            model.setRating_last_value(domain.getRating_last_value());
         if(domain.getDate_assignDirtyFlag())
            model.setDate_assign(domain.getDate_assign());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.getRating_last_feedbackDirtyFlag())
            model.setRating_last_feedback(domain.getRating_last_feedback());
         if(domain.getActivity_date_deadlineDirtyFlag())
            model.setActivity_date_deadline(domain.getActivity_date_deadline());
         if(domain.getAccess_tokenDirtyFlag())
            model.setAccess_token(domain.getAccess_token());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getSubtask_countDirtyFlag())
            model.setSubtask_count(domain.getSubtask_count());
         if(domain.getWorking_hours_openDirtyFlag())
            model.setWorking_hours_open(domain.getWorking_hours_open());
         if(domain.getWorking_hours_closeDirtyFlag())
            model.setWorking_hours_close(domain.getWorking_hours_close());
         if(domain.getDescriptionDirtyFlag())
            model.setDescription(domain.getDescription());
         if(domain.getRating_last_imageDirtyFlag())
            model.setRating_last_image(domain.getRating_last_image());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getDisplayed_image_idDirtyFlag())
            model.setDisplayed_image_id(domain.getDisplayed_image_id());
         if(domain.getTag_idsDirtyFlag())
            model.setTag_ids(domain.getTag_ids());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getActivity_type_idDirtyFlag())
            model.setActivity_type_id(domain.getActivity_type_id());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getActivity_idsDirtyFlag())
            model.setActivity_ids(domain.getActivity_ids());
         if(domain.getKanban_stateDirtyFlag())
            model.setKanban_state(domain.getKanban_state());
         if(domain.getSequenceDirtyFlag())
            model.setSequence(domain.getSequence());
         if(domain.getNotesDirtyFlag())
            model.setNotes(domain.getNotes());
         if(domain.getActivity_summaryDirtyFlag())
            model.setActivity_summary(domain.getActivity_summary());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.getDate_last_stage_updateDirtyFlag())
            model.setDate_last_stage_update(domain.getDate_last_stage_update());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.getWorking_days_openDirtyFlag())
            model.setWorking_days_open(domain.getWorking_days_open());
         if(domain.getActivity_user_idDirtyFlag())
            model.setActivity_user_id(domain.getActivity_user_id());
         if(domain.getWorking_days_closeDirtyFlag())
            model.setWorking_days_close(domain.getWorking_days_close());
         if(domain.getActiveDirtyFlag())
            model.setActive(domain.getActive());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getEmail_ccDirtyFlag())
            model.setEmail_cc(domain.getEmail_cc());
         if(domain.getDate_endDirtyFlag())
            model.setDate_end(domain.getDate_end());
         if(domain.getChild_idsDirtyFlag())
            model.setChild_ids(domain.getChild_ids());
         if(domain.getPlanned_hoursDirtyFlag())
            model.setPlanned_hours(domain.getPlanned_hours());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getPriorityDirtyFlag())
            model.setPriority(domain.getPriority());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getColorDirtyFlag())
            model.setColor(domain.getColor());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getAccess_urlDirtyFlag())
            model.setAccess_url(domain.getAccess_url());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getSubtask_planned_hoursDirtyFlag())
            model.setSubtask_planned_hours(domain.getSubtask_planned_hours());
         if(domain.getLegend_doneDirtyFlag())
            model.setLegend_done(domain.getLegend_done());
         if(domain.getLegend_blockedDirtyFlag())
            model.setLegend_blocked(domain.getLegend_blocked());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getPartner_id_textDirtyFlag())
            model.setPartner_id_text(domain.getPartner_id_text());
         if(domain.getManager_idDirtyFlag())
            model.setManager_id(domain.getManager_id());
         if(domain.getProject_id_textDirtyFlag())
            model.setProject_id_text(domain.getProject_id_text());
         if(domain.getParent_id_textDirtyFlag())
            model.setParent_id_text(domain.getParent_id_text());
         if(domain.getUser_id_textDirtyFlag())
            model.setUser_id_text(domain.getUser_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getUser_emailDirtyFlag())
            model.setUser_email(domain.getUser_email());
         if(domain.getSubtask_project_idDirtyFlag())
            model.setSubtask_project_id(domain.getSubtask_project_id());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getStage_id_textDirtyFlag())
            model.setStage_id_text(domain.getStage_id_text());
         if(domain.getLegend_normalDirtyFlag())
            model.setLegend_normal(domain.getLegend_normal());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getUser_idDirtyFlag())
            model.setUser_id(domain.getUser_id());
         if(domain.getProject_idDirtyFlag())
            model.setProject_id(domain.getProject_id());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getPartner_idDirtyFlag())
            model.setPartner_id(domain.getPartner_id());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getParent_idDirtyFlag())
            model.setParent_id(domain.getParent_id());
         if(domain.getStage_idDirtyFlag())
            model.setStage_id(domain.getStage_id());
        return model ;
    }

    public Project_task convert2Domain( Iproject_task model ,Project_task domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Project_task();
        }

        if(model.getDate_startDirtyFlag())
            domain.setDate_start(model.getDate_start());
        if(model.getActivity_stateDirtyFlag())
            domain.setActivity_state(model.getActivity_state());
        if(model.getRating_countDirtyFlag())
            domain.setRating_count(model.getRating_count());
        if(model.getEmail_fromDirtyFlag())
            domain.setEmail_from(model.getEmail_from());
        if(model.getAttachment_idsDirtyFlag())
            domain.setAttachment_ids(model.getAttachment_ids());
        if(model.getDate_deadlineDirtyFlag())
            domain.setDate_deadline(model.getDate_deadline());
        if(model.getKanban_state_labelDirtyFlag())
            domain.setKanban_state_label(model.getKanban_state_label());
        if(model.getAccess_warningDirtyFlag())
            domain.setAccess_warning(model.getAccess_warning());
        if(model.getRating_idsDirtyFlag())
            domain.setRating_ids(model.getRating_ids());
        if(model.getRating_last_valueDirtyFlag())
            domain.setRating_last_value(model.getRating_last_value());
        if(model.getDate_assignDirtyFlag())
            domain.setDate_assign(model.getDate_assign());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.getRating_last_feedbackDirtyFlag())
            domain.setRating_last_feedback(model.getRating_last_feedback());
        if(model.getActivity_date_deadlineDirtyFlag())
            domain.setActivity_date_deadline(model.getActivity_date_deadline());
        if(model.getAccess_tokenDirtyFlag())
            domain.setAccess_token(model.getAccess_token());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getSubtask_countDirtyFlag())
            domain.setSubtask_count(model.getSubtask_count());
        if(model.getWorking_hours_openDirtyFlag())
            domain.setWorking_hours_open(model.getWorking_hours_open());
        if(model.getWorking_hours_closeDirtyFlag())
            domain.setWorking_hours_close(model.getWorking_hours_close());
        if(model.getDescriptionDirtyFlag())
            domain.setDescription(model.getDescription());
        if(model.getRating_last_imageDirtyFlag())
            domain.setRating_last_image(model.getRating_last_image());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getDisplayed_image_idDirtyFlag())
            domain.setDisplayed_image_id(model.getDisplayed_image_id());
        if(model.getTag_idsDirtyFlag())
            domain.setTag_ids(model.getTag_ids());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getActivity_type_idDirtyFlag())
            domain.setActivity_type_id(model.getActivity_type_id());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getActivity_idsDirtyFlag())
            domain.setActivity_ids(model.getActivity_ids());
        if(model.getKanban_stateDirtyFlag())
            domain.setKanban_state(model.getKanban_state());
        if(model.getSequenceDirtyFlag())
            domain.setSequence(model.getSequence());
        if(model.getNotesDirtyFlag())
            domain.setNotes(model.getNotes());
        if(model.getActivity_summaryDirtyFlag())
            domain.setActivity_summary(model.getActivity_summary());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.getDate_last_stage_updateDirtyFlag())
            domain.setDate_last_stage_update(model.getDate_last_stage_update());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.getWorking_days_openDirtyFlag())
            domain.setWorking_days_open(model.getWorking_days_open());
        if(model.getActivity_user_idDirtyFlag())
            domain.setActivity_user_id(model.getActivity_user_id());
        if(model.getWorking_days_closeDirtyFlag())
            domain.setWorking_days_close(model.getWorking_days_close());
        if(model.getActiveDirtyFlag())
            domain.setActive(model.getActive());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getEmail_ccDirtyFlag())
            domain.setEmail_cc(model.getEmail_cc());
        if(model.getDate_endDirtyFlag())
            domain.setDate_end(model.getDate_end());
        if(model.getChild_idsDirtyFlag())
            domain.setChild_ids(model.getChild_ids());
        if(model.getPlanned_hoursDirtyFlag())
            domain.setPlanned_hours(model.getPlanned_hours());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getPriorityDirtyFlag())
            domain.setPriority(model.getPriority());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getColorDirtyFlag())
            domain.setColor(model.getColor());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getAccess_urlDirtyFlag())
            domain.setAccess_url(model.getAccess_url());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getSubtask_planned_hoursDirtyFlag())
            domain.setSubtask_planned_hours(model.getSubtask_planned_hours());
        if(model.getLegend_doneDirtyFlag())
            domain.setLegend_done(model.getLegend_done());
        if(model.getLegend_blockedDirtyFlag())
            domain.setLegend_blocked(model.getLegend_blocked());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getPartner_id_textDirtyFlag())
            domain.setPartner_id_text(model.getPartner_id_text());
        if(model.getManager_idDirtyFlag())
            domain.setManager_id(model.getManager_id());
        if(model.getProject_id_textDirtyFlag())
            domain.setProject_id_text(model.getProject_id_text());
        if(model.getParent_id_textDirtyFlag())
            domain.setParent_id_text(model.getParent_id_text());
        if(model.getUser_id_textDirtyFlag())
            domain.setUser_id_text(model.getUser_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getUser_emailDirtyFlag())
            domain.setUser_email(model.getUser_email());
        if(model.getSubtask_project_idDirtyFlag())
            domain.setSubtask_project_id(model.getSubtask_project_id());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getStage_id_textDirtyFlag())
            domain.setStage_id_text(model.getStage_id_text());
        if(model.getLegend_normalDirtyFlag())
            domain.setLegend_normal(model.getLegend_normal());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getUser_idDirtyFlag())
            domain.setUser_id(model.getUser_id());
        if(model.getProject_idDirtyFlag())
            domain.setProject_id(model.getProject_id());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getPartner_idDirtyFlag())
            domain.setPartner_id(model.getPartner_id());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getParent_idDirtyFlag())
            domain.setParent_id(model.getParent_id());
        if(model.getStage_idDirtyFlag())
            domain.setStage_id(model.getStage_id());
        return domain ;
    }


}
